package com.foundersoftware.commons.organization.dao;

import com.foundersoftware.commons.organization.*;
import com.foundersoftware.commons.organization.model.AbstractOrganizationObject;
import com.foundersoftware.commons.organization.model.Employee;
import com.foundersoftware.commons.organization.model.OrganizationUnit;
import com.foundersoftware.commons.organization.model.OrganizationUnitType;
import com.foundersoftware.commons.organization.model.Position;
import com.foundersoftware.commons.organization.model.PositionType;
import com.foundersoftware.commons.organization.model.Role;
import com.foundersoftware.commons.organization.model.Type;
import com.foundersoftware.commons.organization.model.WorkGroup;
import com.foundersoftware.commons.organization.model.WorkGroupType;
/**
 * 
 * @author wuhongjun@routon.com
 * @version 3.0
 */
public interface IOrganizationDAO extends java.io.Serializable {

    void storeEmployee(Employee employee, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storeOrganizationUnit(OrganizationUnit organizationUnit, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storeOrganizationUnitType(OrganizationUnitType organizationUnitType, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storePosition(Position position, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storePositionType(PositionType positionType, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storeResponsibility(AbstractOrganizationObject responsibility, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storeRole(Role role, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storeRoleType(Type roleType, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storeWorkGroup(WorkGroup workGroup, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;
    void storeWorkGroupType(WorkGroupType workGroupType, boolean isCreated)throws ObjectAlreadyExistsException,PersistenceException;

    void storeEmployeeWithOgranizationUnitRelation(String employeeId,String organizationUnitId) throws ObjectAlreadyExistsException,PersistenceException;
    void storeEmployeeWithWorkGroupRelation(String employeeId,String workGroupId)throws ObjectAlreadyExistsException,PersistenceException;
    void storeEmployeeWithPositionRelation(String employeeId,String positionId) throws ObjectAlreadyExistsException,PersistenceException;
    void storeEmployeeWithRoleAndWorkGroup(String employeeId,String roleId,String workGroupId) throws ObjectAlreadyExistsException,PersistenceException;
    void storeOrganizationUnitWithOrganizationUnitTypeRelation(String organizationUnitId,String organizationUnitTypeId) throws ObjectAlreadyExistsException,PersistenceException;
    void storePositionWithOrganizationUnitRelation(String positionId,String organizationUnitId) throws ObjectAlreadyExistsException,PersistenceException;
    void storeOrganizationUnitWithOrganizationUnitRelation(String superOrgUnitId,String subOrgUnitId)throws ObjectAlreadyExistsException,PersistenceException;
    void storeResponsibilityWithPositonRelation(String responsibilityId,String positionId) throws ObjectAlreadyExistsException,PersistenceException;
    void storePositionWithPositionTypeRelation(String positionId,String positionTypeId)throws ObjectAlreadyExistsException,PersistenceException;
    void storeResponsibilityWithRoleRelation(String responsibilityId,String roleId) throws ObjectAlreadyExistsException,PersistenceException;
    void storeWorkGroupWithWorkGroupRelation(String superWorkGroupId,String subWorkGroupId) throws ObjectAlreadyExistsException,PersistenceException;
    void storeWorkGroupWithWorkGroupType(String workGroupId,String workGroupTypeId) throws ObjectAlreadyExistsException,PersistenceException;
    void storeRoleWithRoleTypeRelation(String roleId,String roleTypeId)throws ObjectAlreadyExistsException,PersistenceException;
    void storeRoleWithWorkGroupRelation(String roleId,String workGroupId)throws ObjectAlreadyExistsException,PersistenceException;


    void deleteEmployee(Employee employee)throws PersistenceException;
    void deleteOrganizationUnit(OrganizationUnit organizationUnit)throws PersistenceException;
    void deleteOrganizationUnitType(OrganizationUnitType organizationUnitType)throws PersistenceException;
    void deletePosition(Position position)throws PersistenceException;
    void deletePositionType(PositionType positionType)throws PersistenceException;
    void deleteResponsibility(AbstractOrganizationObject responsibility)throws PersistenceException ;
    void deleteRole(Role role)throws PersistenceException;
    void deleteRoleType(Type roleType)throws PersistenceException;
    void deleteWorkGroup(WorkGroup workGroup)throws PersistenceException;
    void deleteWorkGroupType(WorkGroupType workGroupType)throws PersistenceException;
    void deleteEmployeeWithOgranizationUnitRelation(String employeeId,String organizationUnitId) throws ObjectAlreadyExistsException,PersistenceException;
    void deleteEmployeeWithWorkGroupRelation(String employeeId,
                                             String workGroupId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteEmployeeWithPositionRelation(String employeeId,
                                            String positionId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteEmployeeWithRoleAndWorkGroup(String employeeId, String roleId,
                                            String workGroupId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteOrganizationUnitWithOrganizationUnitTypeRelation(String
            organizationUnitId, String organizationUnitTypeId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deletePositionWithOrganizationUnitRelation(String positionId,
            String organizationUnitId) throws ObjectAlreadyExistsException,
            PersistenceException;

    void deleteOrganizationUnitWithOrganizationUnitRelation(String
            superOrgUnitId, String subOrgUnitId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteResponsibilityWithPositonRelation(String responsibilityId,
                                                 String positionId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deletePositionWithPositionTypeRelation(String positionId,
                                                String positionTypeId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteResponsibilityWithRoleRelation(String responsibilityId,
                                              String roleId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteWorkGroupWithWorkGroupRelation(String superWorkGroupId,
                                              String subWorkGroupId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteWorkGroupWithWorkGroupType(String workGroupId,
                                          String workGroupTypeId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteRoleWithRoleTypeRelation(String roleId, String roleTypeId) throws
            ObjectAlreadyExistsException, PersistenceException;

    void deleteRoleWithWorkGroupRelation(String roleId, String workGroupId) throws
            ObjectAlreadyExistsException, PersistenceException;





     Employee getEmployee(String employeeid)throws PersistenceException;
     OrganizationUnitType getOrganizationUnitType(String organiztionUnitTypeId)throws PersistenceException;
     OrganizationUnit getOrganizationUnit(String organizationUnitId)throws PersistenceException;
     PositionType getPostionType(String positionTypeId)throws PersistenceException;
     Position getPosition(String positionId)throws PersistenceException;
     Type getRoleType(String roleTypeId)throws PersistenceException;
     Role getRole(String roleId)throws PersistenceException;
     WorkGroupType getWorkGroupType(String workGroupTypeId)throws PersistenceException;
     WorkGroup getWorkGroup(String workGroupId)throws PersistenceException;
     AbstractOrganizationObject getResponsibility(String responsibilityId)throws PersistenceException;
    boolean isExistsEmployeeWithOgranizationUnitRelation(String employeeId,String organizationUnitId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsEmployeeWithWorkGroupRelation(String employeeId,String workGroupId)throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsEmployeeWithPositionRelation(String employeeId,String positionId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsEmployeeWithRoleAndWorkGroup(String employeeId,String roleId,String workGroupId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsOrganizationUnitWithOrganizationUnitTypeRelation(String organizationUnitId,String organizationUnitTypeId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsPositionWithOrganizationUnitRelation(String positionId,String organizationUnitId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsOrganizationUnitWithOrganizationUnitRelation(String superOrgUnitId,String subOrgUnitId)throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsResponsibilityWithPositonRelation(String responsibilityId,String positionId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsPositionWithPositionTypeRelation(String positionId,String positionTypeId)throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsResponsibilityWithRoleRelation(String responsibilityId,String roleId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsWorkGroupWithWorkGroupRelation(String superWorkGroupId,String subWorkGroupId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsWorkGroupWithWorkGroupType(String workGroupId,String workGroupTypeId) throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsRoleWithRoleTypeRelation(String roleId,String roleTypeId)throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsRoleWithWorkGroupRelation(String roleId,String workGroupId)throws ObjectAlreadyExistsException,PersistenceException;
    boolean isExistsEmployee(String employeeId)throws PersistenceException;
    boolean isExistsOrganizationUnit(String orgUnitId) throws PersistenceException;
    boolean isExistsOrganizationUnitType(String orgUnitType) throws PersistenceException;



     //��ѯ��ӿ�-��ѯ����
      Employee[] getAllEmployees();
      OrganizationUnitType[] getAllOrganizationUnitTypes();
      OrganizationUnit[] getAllOrganizationUnits();
      PositionType[] getAllPositionTypes();
      Position[] getAllPositions();
      Type[] getAllRoleTypes();
      Role[] getAllRoles();
      WorkGroupType[] getAllWorkGroupTypes();
      WorkGroup[] getAllWorkGroups();
      AbstractOrganizationObject[] getAllResponsibilities();
      //��ѯ��ӿ�-��������ѯ
      Employee[] getEmployeesOfOrganizationUnit(OrganizationUnit organizationUnit,
                                                boolean isDirect);
      OrganizationUnit[] getChildOrganizationUnits(OrganizationUnit
                                                   superOrganizationUnit);
      Position[] getPositionsOfOrganizationUnit(OrganizationUnit organizationUnit);
      Role[] getRolesOfWorkGroup(WorkGroup workGroup);
      Role[] getRolesOfEmployee(Employee employee, WorkGroup workGroup);
      Position getPositionsOfEmployee(Employee employee);
      AbstractOrganizationObject[] getResponsibilitiesOfRole(Role role);
      AbstractOrganizationObject[] getResponsibilitiesOfPosition(Position position);

}
